package hcn.protocol.brandnew.dengji.menzhenyuyue;

import com.fasterxml.jackson.annotation.JsonFormat;
import ctd.util.xml.jaxb.DateTimeAdapter;
import hcn.protocol.brandnew.BaseRequest;
import lombok.Data;
import org.atag.sysrouter.annotation.DictionaryMapping;

import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Date;
import java.util.List;


/**
 * 门诊预约信息查询-消息请求 - ODS_02040014
 *
 * @author enjoyLife
 */
@Data
@XmlRootElement(name = "MsgBody")
@XmlAccessorType(XmlAccessType.FIELD)
public class ListAppointmentWaitRequest extends BaseRequest {

    /**
     * 预约信息
     */
    @XmlElement(name = "Query")
    private Query query;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class IdCardList {

        /**
         * 身份证件号码
         */
        @XmlElement(name = "IdCard")
        private String idCard;
        /**
         * 身份证件类别代码
         */
        @XmlElement(name = "IdCardCode")
        @DictionaryMapping(id = "CV02_01_101")
        private String idCardCode;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class MedicalCardList {

        /**
         * 患者卡号
         */
        @XmlElement(name = "MedicalCardId")
        private String medicalCardId;
        /**
         * 诊疗卡类型
         */
        @XmlElement(name = "MedicalCardType")
        private String medicalCardType;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class PatientIdList {

        /**
         * 患者ID
         */
        @XmlElement(name = "SourcePatientId")
        private String sourcePatientId;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Query {

        /**
         * 开始时间
         */
        @XmlElement(name = "StartTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date startTime;
        /**
         * 结束时间
         */
        @XmlElement(name = "EndTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date endTime;
        /**
         * 医疗机构组织机构代码
         */
        @XmlElement(name = "VisitOrganization")
        private String visitOrganization;
        /**
         * 查询组合类型
         */
        @XmlElement(name = "QueryType")
        private String queryType;
        /**
         * 资源池类型
         */
        @XmlElement(name = "OutpatientType")
        private Byte outpatientType;
        /**
         * 每页条数
         */
        @XmlElement(name = "PageSize")
        private Long pageSize;
        /**
         * 分页页数
         */
        @XmlElement(name = "PageNo")
        private Long pageNo;
        /**
         * 预约流水号
         */
        @XmlElement(name = "AppointsId")
        private String appointsId;
        /**
         * 预约状态码
         */
        @XmlElement(name = "AppointmentStatus")
        private String appointmentStatus;
        /**
         * 患者证件列表
         */
        @XmlElementWrapper(name = "IdCardLists")
        @XmlElement(name = "IdCardList")
        private List<IdCardList> idCardLists;
        /**
         * 患者卡列表
         */
        @XmlElementWrapper(name = "MedicalCardLists")
        @XmlElement(name = "MedicalCardList")
        private List<MedicalCardList> medicalCardLists;
        /**
         * 患者ID列表
         */
        @XmlElementWrapper(name = "PatientIdLists")
        @XmlElement(name = "PatientIdList")
        private List<PatientIdList> patientIdLists;


        @XmlElement(name = "CombinedQuery")
        private CombinedQuery combinedQuery;


        /**
         * 门诊号
         */
        @XmlElement(name = "ClinicId")
        private String clinicId;
        /**
         * 姓名
         */
        @XmlElement(name = "Name")
        private String name;
        /**
         * 患者电话
         */
        @XmlElement(name = "PatientPhone")
        private String patientPhone;
        /**
         * 证件号后四位
         */
        @XmlElement(name = "IdCard")
        private String idCard;
        /**
         * 1普通,2专家
         */
        @XmlElement(name = "RegisteredType")
        private String registeredType;
        /**
         * 1已挂,0已改约
         */
        @XmlElement(name = "OperationType")
        private String operationType;
        /**
         * 科室id
         */
        @XmlElement(name = "DepartmentId")
        private String departmentId;
        /**
         * 操作开始时间
         */
        @XmlElement(name = "OperateBeginDate")
        private String operateBeginDate;
        /**
         * 操作结束时间
         */
        @XmlElement(name = "OperateEndDate")
        private String operateEndDate;

        @XmlElement(name = "AppointBeginDateTime")
        private String appointBeginDateTime;

        @XmlElement(name = "AppointEndDateTime")
        private String appointEndDateTime;

    }



    @XmlAccessorType(XmlAccessType.FIELD)
    @Data
    public static class CombinedQuery {
        /**
         * 挂号科室代码
         */
        @XmlElement(name = "DeptCode")
        private String deptCode;
        /**
         * 预约状态
         */
        @XmlElement(name = "AppointmentStatus")
        private String appointmentStatus;
        /**
         * 资源级别
         */
        @XmlElement(name = "ResourceLevelCode")
        private String resourceLevelCode;
        /**
         * 根据患者姓名模糊查询
         */
        @XmlElement(name = "Keyword")
        private String keyword;
        /**
         * 根据医生姓名模糊查询
         */
        @XmlElement(name = "KeywordT")
        private String keywordT;
    }

}
